package com.producer.enums;

/**
 * @Author : liu lin qin
 * @Date :  Created by pangoin on 2019/8/26.
 */
public enum TopicEnum {

    ALARM("ALARM","告警"),
    PERFORMANCE("PERFORMANCE","性能"),
    RESOURCES("RESOURCES","资源");
    private String code;
    private String name;
    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setCode(String code) {
        this.code = code;
    }

    private TopicEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }


    // 根据value返回枚举类型,主要在switch中使用
    public static TopicEnum getByValue(String code  ) {
        for (TopicEnum brand : values()) {
            if (brand.getCode().equals(code) ) {
                return brand;
            }
        }
        return null;
    }
}
